<!DOCTYPE html>
<html lang="zh-CN">
<head>
    {% include 'day62/_head.html' %}
    <title>书籍列表</title>
</head>
<body>
{% include 'day62/_nav.html' %}
<div class="container-fluid">
    <div class="row">
        {% include 'day62/_left.html' %}
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h1 class="page-header">快报名跟我学Python吧</h1>

            <div class="panel panel-primary">
                <!-- Default panel contents -->
                <div class="panel-heading">图书列表 <i class="fa fa-thumb-tack pull-right"></i></div>
                <div class="panel-body">
                    {% include 'day62/_book_search.html' %}
                    <table class="table table-bordered">
                        <thead>
                        <tr>
                            <th>#</th>
                            <th>书名</th>
                            <th>作者</th>
                            <th>出版社</th>
                            <th>定价</th>
                            <th>当前价格</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for book in list %}
                            <tr>
                                <td>{{ forloop.counter }}</td>
                                <td>{{ book.title }}</td>
                                <td>{{ book.publisher.name }}</td>
                                <td>{{ book.author.name }}</td>
                                <td>{{ book.start_price }}</td>
                                <td>{{ book.now_price }}</td>
                                <td>
                                    <a class="btn btn-danger"
                                       href="/book/delete.html?bid={{ book.id }}">删除</a>
                                    <a class="btn btn-info" href="/book/edit.html?bid={{ book.id }}">编辑</a>
                                </td>
                            </tr>
                        {% endfor %}
                        </tbody>
                    </table>
                    {% include 'day62/_paginator.html' %}
                </div>

            </div>
        </div>
    </div>
</div>


<div class="modal fade" tabindex="-1" role="dialog" id="publisherAddModal">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">添加出版社</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/book/add.html" method="post">
                    {% csrf_token %}
                    <div class="form-group">
                        <label for="publisher_name" class="col-sm-2 control-label">名称</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="title"
                                   placeholder="请输入图书名称...">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="publisher_name" class="col-sm-2 control-label">作者</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="author"
                                   placeholder="请输入作者名称...">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="publisher_name" class="col-sm-2 control-label">出版社</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="publisher"
                                   placeholder="请输入出版社名称...">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="publisher_name" class="col-sm-2 control-label">原价</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="start_price"
                                   placeholder="请输入定价...">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="publisher_name" class="col-sm-2 control-label">当前价格</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="now_price"
                                   placeholder="请输入当前价格...">
                        </div>
                    </div>

                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <input type="submit" class="btn btn-primary" value="保存">
                    </div>
                </form>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="/static/jquery-3.3.1.js"></script>
<script src="/static/bootstrap/js/bootstrap.js"></script>

</body>
</html>